package com.kongwg.java;

import org.junit.Test;

/**
 * @author kongwg
 * @create 2020-12-07 15:58
 */
public class StringTest1 {

    @Test
    public void test(){
    /**
     * String -->char[]
     */
    String str = "abc123";
        char[] chars = str.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            System.out.println(chars[i]);

        }


    }


    @Test
    public void test1(){

        /**
         * String --> 基本数据类型   Integer.paretInt(str);
         * 基本数据类型转换为String   str.valueOf();
         */

        String str = "123";

        int i = Integer.parseInt(str);
        System.out.println(i);

        String s = String.valueOf(i);
        System.out.println(s);

    }
}
